package com.sky.api.client.user;

import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.ShoppingCart;
import com.sky.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "shoppingCart-server")
public interface ShoppingCartClient {

    /**
     * 添加购物车
     * @param shoppingCartDTO
     * @return
     */
    @PostMapping("/user/shoppingCart/add")
    Result add(@RequestBody ShoppingCartDTO shoppingCartDTO);

    /**
     * 查看购物车
     * @return
     */
    @GetMapping("/user/shoppingCart/list")
    Result<List<ShoppingCart>> list();

    /**
     * 清空购物车
     * @return
     */
    @DeleteMapping("/user/shoppingCart/clean")
    Result clean();

    /**
     * 删除购物车中一个商品
     * @param shoppingCartDTO
     * @return
     */
    @PostMapping("/user/shoppingCart/sub")
    Result sub(@RequestBody ShoppingCartDTO shoppingCartDTO);

    //TODO 调用 shoppingCartMapper.insertBatch(shoppingCartList);
    @PostMapping("/user/addressBook/insertBatch")
    void insertBatch (List<ShoppingCart> shoppingCartList);
}
